defmodule Servis do

  def status(service) do
    durum='servis #{service} durum' |> :os.cmd |> to_string |> String.split("\n")
    |> Enum.member?("aktif")
    case durum do
      true  -> :true
      false -> :false
    end
  end
  
  @doc """
		
     servis başlatır

  """
  
  def start(service) do
    'servis #{service} start' |> :os.cmd
    service |> status
  end
  
  def stop(service) do
    'servis #{service} stop' |> :os.cmd
    service |> status
  end
  
  def info(service) do
    File.read!("/etc/init.d/" <> service)
  end
  
end
